// pages/confirm/confirm.js
const APP = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
      showAdd: true,
      addressData: {
        name: '许小星',
        mobile: '13853989563',
        addressName: '金九大道',
        address: '山东省济南市历城区',
        area: '149号',
        // default: false,
      },
      byStages: {
        payment: 2029.75,
        payment2: 1.00,
        TotalAmount: 8400.00,
        insurance: 599,
      },
      deposit: {
        depositMoney: 16800,
      },
      productData: {
        url: 'https://shop.rongyiht.com/static/images/project/iphone15.png',
        phone: 'iPhone 15',
        phoneType: '分期产品 粉色 512G',
        fenqi: '5',
        numberph: '1',
        default: false,
      },
      inputClearValue: '',
      showClearIcon: false,
      param:{
        package:1,
        color:1,
        period:1,
        num:1,
        version:1,
        server:1,
        project_id:''
      },
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
 
    let id = options.id;
    let package1 = options.package;
    let color = options.color;
    let period = options.period;
    let version = options.version;
    let server = options.server;
    this.setData({
        "param.package":package1,
        "param.color":color,
        "param.period":period,
        "param.version":version,
        "param.server":server,
        "param.project_id":id
    })
    let that = this;
    APP.http('post','/project_detail',{project_id:id},function(res){
      if(res.code==1){
        that.setData({
          detail:res.data.project,
          "param.price":res.data.project.price,
          "param.project_name":res.data.project.price
        })
      }else{
        wx.showLoading({
          title: '拼命加载中',
        })
      }
    })
  },
  submit_order(){
    
    APP.http('post','customer_app_order',this.data.param,function(res){
      if(res.code==1){
        wx.showToast({
          title: '已提交',
          icon:'success'
        })
        APP.jump('../myorder/myorder');
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})